function []=save_adata(adata_dir,ROIs,bv,np,template,dx,dy,aux_files,fnames,nbr_frames,mouse_id,userID,act_map)

% if ~strcmp(mouse_id(1:3),'GK_')
%     disp('mouse ID problem!')
%     return
% end

if ~isdir([adata_dir userID '\' mouse_id])
    mkdir([adata_dir userID], mouse_id);
end

try
    save([adata_dir userID '\' mouse_id '\Adata-' fnames{1}(1:strfind(fnames{1},'_')-1)],'ROIs','bv','np','template','dx','dy','aux_files','fnames','mouse_id','nbr_frames','act_map','-append','-v7.3');
catch
    save([adata_dir userID '\' mouse_id '\Adata-' fnames{1}(1:strfind(fnames{1},'_')-1)],'ROIs','bv','np','template','dx','dy','aux_files','fnames','mouse_id','nbr_frames','act_map','-v7.3');
end
disp('Saved Adata');